<template>
  <div class="home">
    <!-- 头部 -->
    <van-nav-bar title="商品列表" right-text="去购物" />
    <!-- 商品列表 -->
    <div class="home_list_box">
      <div v-for="(item,index) in shoplist" :key="index" @click="gotoxq(item.id)">
        <div>
          <img :src="item.mainPic" width="100%" />
        </div>
        <p class="oDiv">{{item.title}}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      shoplist: []
    };
  },
  mounted() {
    // 商品列表
    this.$network.getStoreList({}).then(res => {
      console.log(res.data.data.data.list);
      this.shoplist = res.data.data.data.list;
    });
  },
  methods:{
    gotoxq(id){
    this.$router.push({
      path:"/about",
      query:{
        id:id
      }
    })
  }
  }
};
</script>
<style  scoped>
.home_list_box {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}
.home_list_box > div {
  width: 46%;
  border: 1px solid red;
  margin: 5px;
  /* height: 260px; */
}
/* 两行隐藏 */
.oDiv {
  text-overflow: -o-ellipsis-lastline;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>
